from django.contrib import admin

# Register your models here.
from markdown.models import MdFiles
from markdown.models import MdSpace

class MdFilesAdmin(admin.ModelAdmin):
    # 指定后台网页要显示的字段
    list_display = ["id", "doc_type", "space", "upload_dir", "upload_name", "cn_name", "cur_editor"]
    list_per_page = 15
    # 右侧栏过滤器
    list_filter = ['space']
    # 要搜索的列的值
    search_fields = ['upload_name']
    fields = (('doc_type', 'space'), ('upload_dir', 'upload_name', 'cn_name'), 'cur_editor')
    ordering = ['id']

class MdSpaceAdmin(admin.ModelAdmin):
    # 指定后台网页要显示的字段
    list_display = ["id", "type", "space", "upload_dir", "description"]
    fields = (('type', 'space'), 'upload_dir', 'description')
    list_per_page = 15
    ordering = ['id']

# 注册到admin
admin.site.register(MdFiles, MdFilesAdmin)
admin.site.register(MdSpace, MdSpaceAdmin)
